package c02;

import java.util.Scanner;

public class Xiexie14 {
    public static void main(String[] args) {
        double toothbrush=8.8;
        double towel=10.0;
        double cup=18.8;
        double apple=12.5;
        double banana=15.5;
        int i=0;
        String a="Y";
        System.out.println("-----------黑马小商城-----------");
        System.out.println("1.牙刷的价格为："+toothbrush+"元");
        System.out.println("2.毛巾的价格为："+towel+"元");
        System.out.println("3.水杯的价格为："+cup+"元");
        System.out.println("4.苹果的价格为："+apple+"元");
        System.out.println("5··.香蕉的价格为："+banana+"元");
        while (a.equals("Y")){
            Scanner scl = new Scanner(System.in);
            System.out.println("请输入你需要购买的商品序列号：");
            i=scl.nextInt();
            switch (i){
                case 1:
                    System.out.println("请输入你需要的牙刷数量：");
                    int toothbrushnnumber=scl.nextInt();
                    double toothbrushnnum=toothbrushnnumber*toothbrush;
                    System.out.println("你购买了牙刷"+toothbrushnnum+"支，需要花费"+toothbrushnnum+"元");
                    System.out.println("需要继续购买请输入Y,否则输入N");
                    a=scl.next();
                    break;
                case 2:
                    System.out.println("请输入你需要的毛巾数量：");
                    int towelnumber=scl.nextInt();
                    double towelnum=towelnumber*towel;
                    System.out.println("你购买了毛巾"+towelnumber+"个，需要花费"+towelnum+"元");
                    System.out.println("需要继续购买请输入Y,否则输入N");
                    a=scl.next();
                    break;
                case 3:
                    System.out.println("请输入你需要的水杯数量：");
                    int cupnumber=scl.nextInt();
                    double cupnum=cupnumber*cup;
                    System.out.println("你购买了水杯"+cupnumber+"个，需要花费"+cupnum+"元");
                    System.out.println("需要继续购买请输入Y,否则输入N");
                    a=scl.next();
                    break;
                case 4:
                    System.out.println("请输入你需要的苹果数量：");
                    int applenumber=scl.nextInt();
                    double applenum=applenumber*apple;
                    System.out.println("你购买了苹果"+applenumber+"斤，需要花费"+applenum+"元");
                    System.out.println("需要继续购买请输入Y,否则输入N");
                    a=scl.next();
                    break;
                case 5:
                    System.out.println("请输入你需要的香蕉数量：");
                    int banananumber=scl.nextInt();
                    double banananum=banananumber*banana;
                    System.out.println("你购买了牙刷"+banananumber+"斤，需要花费"+banananum+"元");
                    System.out.println("需要继续购买请输入Y,否则输入N");
                    a=scl.next();
                    break;
            }
        }
        System.out.println("期待你的下次光临");
    }
}
